import { reactive, inject } from "vue";

export const useProjectDetail = () => {
    //获取API配置
    const API = inject("API") as any;
    const ApiConfig = inject("ApiConfig") as any;
    const projectDetail = reactive(
        {
            data: [] as any,
        }
    );

    //查询
    const getDetail = async (projectId) => {
        try {
            const response = await API.request(
                ApiConfig.Methods.GET,
                ApiConfig.PATH.Project.GetProjectDetail,
                {
                    projectId: projectId
                }
            );
            if (response.status == "200" && response.data.code == "200") {
                projectDetail.data = response.data.data;
            }
        } catch (error) {
            console.error(error);
        }
    };
    return { projectDetail, getDetail };
};